﻿#region

using System.Collections.Generic;

#endregion

namespace CDNSync
{
    public abstract class OperationResult
    {
        protected OperationResult()
        {
            LogMessages = new List<string>();
            Errors = new List<string>();
        }

        public List<string> LogMessages { get; set; }

        public List<string> Errors { get; set; }

        public bool WasSuccessful
        {
            get { return Errors.Count == 0; }
        }


        public void AddLogMessage(string message)
        {
            LogMessages.Add(message);
        }

        public void AddErrors(IEnumerable<string> errors)
        {
            Errors.AddRange(errors);
        }

        public void AddLogMessages(IEnumerable<string> messages)
        {
            LogMessages.AddRange(messages);
        }

        public void AddError(string message)
        {
            Errors.Add(message);
        }
    }
}